package com.action;

import java.util.Map;

import javax.servlet.ServletContext;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.interceptor.ApplicationAware;
import org.apache.struts2.interceptor.ParameterAware;
import org.apache.struts2.interceptor.RequestAware;
import org.apache.struts2.interceptor.ServletRequestAware;
import org.apache.struts2.interceptor.ServletResponseAware;
import org.apache.struts2.interceptor.SessionAware;
import org.apache.struts2.util.ServletContextAware;

import com.opensymphony.xwork2.ActionSupport;
@ParentPackage("struts")
public abstract class BaseAction extends ActionSupport implements 
		RequestAware,SessionAware,ApplicationAware,ParameterAware,
		ServletRequestAware,ServletResponseAware,ServletContextAware{
		protected ServletContext application;
		protected HttpServletResponse response;
		protected HttpServletRequest request;
		protected Map<String, String[]> parametersMap;
		protected Map<String, Object> applicationMap;
		protected Map<String, Object> sessionMap;
		protected Map<String, Object> requestMap;
		String statusCode;
		String message;
		String navTabId;
		String rel;
		String callbackType;
		String forwardUrl;
		String confirmMsg;
		
		public void setRequest(Map<String, Object> arg0) {
			this.requestMap = arg0;
			
			}
			
			public void setSession(Map<String, Object> arg0) {
			this.sessionMap = arg0;
			
			}
			
			public void setApplication(Map<String, Object> arg0) {
			this.applicationMap = arg0;
			
			}
			
			public void setParameters(Map<String, String[]> arg0) {
			this.parametersMap = arg0;
			}
			
			public void setServletRequest(HttpServletRequest arg0) {
			this.request = arg0;
			}
			
			public void setServletResponse(HttpServletResponse arg0) {
			this.response = arg0;
			}
			
			public void setServletContext(ServletContext arg0) {
			this.application = arg0;
			}


			
			public String getStatusCode() {
				return statusCode;
			}
			public void setStatusCode(String statusCode) {
				this.statusCode = statusCode;
			}
			public String getMessage() {
				return message;
			}
			public void setMessage(String message) {
				this.message = message;
			}
			public String getNavTabId() {
				return navTabId;
			}
			public void setNavTabId(String navTabId) {
				this.navTabId = navTabId;
			}
			public String getRel() {
				return rel;
			}
			public void setRel(String rel) {
				this.rel = rel;
			}
			public String getCallbackType() {
				return callbackType;
			}
			public void setCallbackType(String callbackType) {
				this.callbackType = callbackType;
			}
			public String getForwardUrl() {
				return forwardUrl;
			}
			public void setForwardUrl(String forwardUrl) {
				this.forwardUrl = forwardUrl;
			}
			public String getConfirmMsg() {
				return confirmMsg;
			}
			public void setConfirmMsg(String confirmMsg) {
				this.confirmMsg = confirmMsg;
			}
			protected void setJson(String statusCode, String message, String navTabId, String rel, String callbackType,
					String forwardUrl, String confirmMsg) {
				//"200", "操作成功！", "", "", "closeCurrent", "", ""
				this.statusCode = statusCode;
				this.message = message;
				this.navTabId = navTabId;
				this.rel = rel;
				this.callbackType = callbackType;
				this.forwardUrl = forwardUrl;
				this.confirmMsg = confirmMsg;
			}
			protected void setOkJson(){		
				this.statusCode = "200";
				this.message = "操作成功！";
				this.navTabId = "";
				this.rel = "";
				this.callbackType = "forward";
				this.forwardUrl = "";
				this.confirmMsg = "";		
			}
		
		}